using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Media;
using SharpMap.Rendering;


namespace SharpMap.Wpf.Rendering
{

    public class WpfRenderObject : Freezable
    {

        public WpfRenderObject()
        {

        }
        public WpfRenderObject(StreamGeometry streamPath, Brush fill, Brush highlightFill, Brush selectFill,

            Pen line, Pen highlightLine, Pen selectLine, Pen outline,
                              Pen highlightOutline, Pen selectOutline, RenderState state)
        {

            State = state;

            WpfStreamPath = streamPath;

            AffineTransform = Matrix.Identity;
            Bounds = new Rect();
            Text = null;

            //ColorTransform = null;
        }


        public WpfRenderObject(ImageSource symbol, System.Windows.Rect bounds, Matrix transform, RenderState state)
        {

            State = state;
    
            AffineTransform = transform;
            //ColorTransform = colorTransform;
            Bounds = bounds;
            WpfStreamPath = null;

            Text = null;

        }

        public WpfRenderObject(FormattedText formattedText, Rect bounds, Brush fill, Brush highlightFill, Brush selectFill,
 Pen outline, Pen highlightOutline, Pen selectOutline, Matrix transform)
        {

            WpfStreamPath = null;

            Bounds = new Rect();
            AffineTransform = transform;

            //ColorTransform = null;
            Text = formattedText;

            Bounds = bounds;
        }




        public RenderState State
        {
            get { return (RenderState)GetValue(StateProperty); }
            set { SetValue(StateProperty, value); }
        }

        public static readonly DependencyProperty StateProperty =
            DependencyProperty.Register("State", typeof(RenderState), typeof(WpfRenderObject), new PropertyMetadata(RenderState.Normal));

        public Rect Bounds
        {
            get { return (Rect)GetValue(BoundsProperty); }
            set { SetValue(BoundsProperty, value); }
        }

        public static readonly DependencyProperty BoundsProperty =
            DependencyProperty.Register("Bounds", typeof(Rect), typeof(WpfRenderObject));

        /// <summary>
        /// The affine transform applied to the symbol before drawing.
        /// </summary>
        public Matrix AffineTransform
        {
            get { return (Matrix)GetValue(AffineTransformProperty); }
            set { SetValue(AffineTransformProperty, value); }
        }

        // Using a DependencyProperty as the backing store for AffineTransform.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty AffineTransformProperty =
            DependencyProperty.Register("AffineTransform", typeof(Matrix), typeof(WpfRenderObject));

        //TODO: consider making read only
        /// <summary>
        /// The path to draw when <see cref="Type"/> is 
        /// </summary>
        public StreamGeometry WpfStreamPath
        {
            get { return (StreamGeometry)GetValue(WpfStreamPathProperty); }
            set { SetValue(WpfStreamPathProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WpfStreamPath.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WpfStreamPathProperty =
            DependencyProperty.Register("WpfStreamPath", typeof(StreamGeometry), typeof(WpfRenderObject));

        //TODO: consider making read only
        public FormattedText Text
        {
            get { return (FormattedText)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(FormattedText), typeof(WpfRenderObject));

        protected override Freezable CreateInstanceCore()
        {
            return new WpfRenderObject();
        }
    }
    
}
